package com.aaamvc.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.aaamvc.entity.UserInfo;
import com.aaamvc.service.UserInfoService;
import com.aaamvc.util.Controller;
import com.aaamvc.util.RequestMapping;
@Controller
@RequestMapping("/userAction")
public class UserAction {
	//封装表单数据
	private UserInfo userInfo;
	//引入业务类
	private UserInfoService userInfoService = new UserInfoService();
	
	@RequestMapping("/save")
	public String save(HttpServletRequest request,HttpServletResponse response)
	{
		//1.执行业务代码
		List<UserInfo> userList = userInfoService.save(userInfo);
		//2.测试添加数据
		System.out.println(userList);
		//3.request,response对象传递数据
		request.setAttribute("userList", userList);
		return "userlist";
	}
	@RequestMapping("/query")
	public String query(HttpServletRequest request,HttpServletResponse response)
	{
		//1.执行业务代码
		List<UserInfo> userList = userInfoService.save(userInfo);
		//2.测试添加数据
		System.out.println(userList);
		//3.request,response对象传递数据
		request.setAttribute("userList", userList);
		return "userlist";
	}
	public UserInfo getUserInfo() {
		return userInfo;
	}
	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}
	
}
